#define _CRT_SECURE_NO_WARNINGS
#include <map>
#include <string>
#include <vector>
#include <iostream>

using namespace std;

int Test1()
{

	vector<string> name = { "Mary","John","Emma" };
	vector<int> height = { 180,165,170 };

	map<int, string> m;

	for (int i = 0; i < name.size(); i++)
	{
		m.insert(make_pair(height[i], name[i]));
	}

	vector<string> str;
	for (map<int, string>::iterator it = m.begin(); it != m.end(); it++)
	{
		str.push_back(it->second);
	}

	for (auto e : str)
	{
		cout << e << " ";
	}
	return 0;
}

int Test2()
{
	vector<string> name = { "Mary","John","Emma" };
	vector<int> height = { 180,165,170 };

	map<int, string> m;

	for (int i = 0; i < name.size(); i++)
	{
		m.insert(make_pair(height[i], name[i]));
	}

	// m.erase();

	for (auto it = m.begin(); it != m.end(); it++){
		m.erase(it);
	}

	return 0;
}

int main()
{
	map<string, int> m;
	m.insert({ {"zhansan", 10},{"lisi",20},{"wangwu",30} });

	for (auto it = m.begin(); it != m.end(); it++)
	{
		cout << it->first << ":" << it->second << endl;
	}

	auto it = m.find("lisi");
	if (it != m.end())
	{
		cout << it->first << " : " << it->second << endl;
	}

	cout << m.count("lisi") << endl;


	return 0;
}